<?php
    session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>SharingFiles</title>
	<link rel="stylesheet" type="text/css" href="style.css" />
    <LINK REL="SHORTCUT ICON" HREF="images/little_logo.png">
</head>
<body>
<?
    include 'db/util.php';
    $link = connectdatabase();
?>
	<div id="header">
    	<a href="."><img src="images/logo.png" title="SharingFiles" id="logo" alt="Logo" /></a>
        <ul id="navBar">
<?
    if (isset($_GET['url'])) {
?>
        	<li><a href="."><b>Home</b></a></li>
<?
        if (isset($_SESSION['logged'])) {
?>
<?
            if ($_GET['url'] == "files") {
?>
            <li class="current"><a href="?url=files"><b>Files</b></a></li>
            <li><a href="?url=welcome"><b>About</b></a></li>
<?
            } elseif ($_GET['url'] == "welcome") {
?>
            <li><a href="?url=files"><b>Files</b></a></li>
            <li class="current"><a href="?url=welcome"><b>About</b></a></li>
<?
            } else {
?>
            <li><a href="?url=files"><b>Files</b></a></li>
            <li><a href="?url=welcome"><b>About</b></a></li>
<?
            }
?>
            <li><a href="?url=logout"><b>Log out</b></a></li>
<?
        } else {
            if ($_GET['url'] == "signup") {
?>
            <li class="current"><a href="?url=signup"><b>Sign up<b></a></li>
<?
            } else {
?>
            <li><a href="?url=signup"><b>Sign up<b></a></li>
<?
            }
        }
?>
<?
    } else {
?>
        	<li class="current"><a href="."><b>Home</b></a></li>
<?
        if (isset($_SESSION['logged'])) {
?>
            <li><a href="?url=files"><b>Files</b></a></li>
            <li><a href="?url=welcome"><b>About</b></a></li>
            <li><a href="?url=logout"><b>Log out</b></a></li>
<?
        } else {
?>
            <li><a href="?url=signup"><b>Sign up<b></a></li>
<?
        }
?>
<?
    }
?>
        </ul>
    </div>
    <div id="welcomeMessage">
    	<h1>Welcome!</h1>
<?
    if (isset($_SESSION['logged'])) {
?>
        <p>Hi <b><?=$_SESSION['name']; ?></b>.<br>Aren't you? <a href="?url=logout">Click here</a>.</p>
        <p>Edit your personal information <a href="?url=personaledit">here</a>.</p>
<?
    } else {
?>
        <br>
<?
    }
?>
    	<p><span>SharingFiles.com</span> is a leading virtual corporate business that will help you monetize your work to the most level you could reach.</p>
    </div>
    <div id="wrapper">
    	<div id="secWrapper">
        	<div id="container" class="clearfix">
<?
    if (isset($_GET['url'])) {
        $filename = "views/" . $_GET['url'] . ".php";
        if (file_exists($filename))
            include $filename;
        else
            include "views/404.php";
    } else {
        if (isset($_SESSION['logged'])) {
            include 'views/home.php';
        } else {
            include 'views/welcome.php';
        }
    }
    include 'views/sidebar.php';
?>
            </div>
        </div>
    </div>
    <div id="footer">
    	<ul>
	        <li><a href="#">Home</a>&nbsp;&nbsp;-&nbsp;&nbsp;</li>
  	        <li><a href="#">Terms and Conditions</a>&nbsp;&nbsp;-&nbsp;&nbsp;</li>
			<li><a href="#">Privacy Policy</a>&nbsp;&nbsp;-&nbsp;&nbsp;</li>
 			<li><a href="#">Sitemap</a>&nbsp;&nbsp;-&nbsp;&nbsp;</li>
  	        <li><a href="#">Support</a>&nbsp;&nbsp;-&nbsp;&nbsp;</li>
			<li><a href="#">Contact Us</a></li>
<?
    if (isset($_SESSION['logged'])) {
?>
            <li>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="?url=logout">Log out</a></li>
<?
    }
?>
        </ul>
        <p>Copyrights &copy; 2011 sharingfiles.com, All Rights Reserved</p>
    </div>
</body>
</html>
